import { defHttp } from '/@/utils/http/axios';
import {  WebsiteMemberUnitModel, WebsiteMemberUnitTableRecordModel } from '../model/websiteMemberUnitModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITEMEMBERUNIT_PAGE = '/jxxhWebsite/websiteMemberUnit/getMemberUnitVosPage',
  GET_WEBSITEMEMBERUNITVO_BY_ID = '/jxxhWebsite/websiteMemberUnit/',
  WEBSITEMEMBERUNITVO_SAVE = '/jxxhWebsite/websiteMemberUnit/save',
  WEBSITEMEMBERUNITVO_UPDATE = '/jxxhWebsite/websiteMemberUnit/updateById',
  WEBSITEMEMBERUNITVO_REMOVE = '/jxxhWebsite/websiteMemberUnit/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteMemberUnitListApi = (params: Object) =>
  defHttp.get<WebsiteMemberUnitTableRecordModel>(
    {url: Api.WEBSITEMEMBERUNIT_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteMemberUnitVoByIdApi = (id) =>
  defHttp.get<WebsiteMemberUnitModel>(
    {url: Api.GET_WEBSITEMEMBERUNITVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteMemberUnitSaveApi(params: WebsiteMemberUnitModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteMemberUnitModel>(
    {
      url: Api.WEBSITEMEMBERUNITVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteMemberUnitUpdateApi(params: WebsiteMemberUnitModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteMemberUnitModel>(
    {
      url: Api.WEBSITEMEMBERUNITVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteMemberUnitModel>(
    {url: Api.WEBSITEMEMBERUNITVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
